package com.guocheng.modules.emp.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guocheng.base.BaseService;
import com.guocheng.modules.emp.mapper.EmpDao;
import com.guocheng.modules.emp.model.po.Emp;
import com.guocheng.modules.emp.model.vo.EmpVo;
import com.guocheng.modules.meet.model.po.Meet;
import com.guocheng.modules.terminals.service.TerminalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class EmpService extends BaseService<EmpDao,Emp> {

    @Autowired
    private TerminalService terminalServicel;

    @Override
    @Transactional(readOnly = false)
    public boolean insert(Emp emp){
        boolean insert = super.insert(emp);

        return insert;
    }

    /**
     * 根据用户id查询照片信息
     * @param id
     * @return
     */
    public List<String> selectPhotosById(int id) {
        return baseDao.selectPhotosById(id);
    }

    /**
     * 根据部门ids查询人员信息
     * @param depts
     * @return
     */
    @Transactional
    public Meet selectByDepts(Meet meet,List<Integer> depts, List<Integer> emps){

        EmpVo empVo = new EmpVo();
        empVo.setDepts(depts);
        empVo.setEmps(emps);
        List<Emp> depts1 = baseDao.selectByDepts(empVo);
        return meet;
    }

    /**
     * 根据部门ids和人员ids查询人员信息
     * @param depts
     * @return
     */
    @Transactional
    public List<Emp> selectByDeptsEmps(List<Integer> depts, List<Integer> emps){
        EmpVo empVo = new EmpVo();
        empVo.setDepts(depts);
        empVo.setEmps(emps);
        return baseDao.selectByDepts(empVo);
    }
}
